<?php
require("../src/define.inc.php");
require("../src/functions.php");
require("../lib/MyMailer.class.php");
//require("../lib/phpmailer/class.phpmailer.php");

$email = 'j.gaujard@gmail.com';
$name = 'Joël Gaujard - test phpmailer';

$mail = new MyMailer();

// HTML body
$body  = "Hello <font size=\"4\">" . $name . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= '<br><a href="' . URL . '">' . URL . '</a>';

// Plain text body (for mail clients that cannot read HTML)
$text_body  = "Hello " . $name . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "phpmailer List manager";
$text_body .= URL;

$mail->From     = "alerte@maci-immobilier.com";
$mail->FromName = "Maci immobilier";
$mail->Subject = "Mes alertes du site Maci immobilier";
$mail->Body    = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($email, $name);
$mail->AddAttachment('../files/photo_annonce/thumb_default.jpg', "Image par Defaut.jpg");

if(!$mail->Send())
	echo "There has been a mail error sending to " . $email . ".<br/>Error: " . $mail->ErrorInfo;
else
	echo "A mail has been sent to " . $email . " successfully.<br/>";

echo '<hr/>';
npr($mail);

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
